<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        function run(year){
            var exp1=year%4==0&&year%100!=0;
            var exp2=year%400==0;
            return exp1||exp2;
        }

        function fn2(num){
            for(var i=2;i<num;i++){
                if(num%i==0){
                    return true;
                }
            }
            return flase; 
        }

        function fn3(y,m,d){
            var max=0;
            if(!(m>=1&&m<=12)){
                return flase;
            }
            if((!d>=1&&d<=31)){
                return flase;
            }
            switch(m){
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:
                    max=31;
                    break;
                case 4:
                case 6:
                case 9:
                case 11:
                    max=30;
                    break;
                default:
                    max=run(y)?29:28;
            }
            return d>=1&&d<=max;
        }
        console.log(fn3(2021,2,28));
    </script>
</body>
</html>